+2006-05-16 Michael Natterer <mitch@imendio.com>
+
+ * gtk/gtktoolbar.c: added "max-child-expand" style property which
+ limits the space taken by expanding tool items. Fixes bug #340722.
+
2006-05-16 Kristian Rietveld <kris@imendio.com>
* gtk/gtkpathbar.c (gtk_path_bar_dispose): cancel all pending handles
+2006-05-16 Michael Natterer <mitch@imendio.com>
+
+ * gtk/gtktoolbar.c: added "max-child-expand" style property which
+ limits the space taken by expanding tool items. Fixes bug #340722.
+
2006-05-16 Kristian Rietveld <kris@imendio.com>
* gtk/gtkpathbar.c (gtk_path_bar_dispose): cancel all pending handles
typedef struct _ToolbarContent ToolbarContent;
-#define DEFAULT_IPADDING 0
+#define DEFAULT_IPADDING 0
#define DEFAULT_SPACE_SIZE 12
#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
static gint get_internal_padding (GtkToolbar *toolbar);
+static gint get_max_child_expand (GtkToolbar *toolbar);
static GtkShadowType get_shadow_type (GtkToolbar *toolbar);
static gint get_space_size (GtkToolbar *toolbar);
static GtkToolbarSpaceStyle get_space_style (GtkToolbar *toolbar);
G_MAXINT,
DEFAULT_IPADDING,
GTK_PARAM_READABLE));
-
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("max-child-expand",
+ P_("Maximum toolbar item spacing"),
+ P_("Maximum space between the toolbar items."),
+ 0,
+ G_MAXINT,
+ G_MAXINT,
+ GTK_PARAM_READABLE));
+
gtk_widget_class_install_style_property (widget_class,
g_param_spec_enum ("space-style",
P_("Space style"),
if (toolbar_content_get_expand (content) && new_states[i] == NORMAL)
{
+ gint mexpand = get_max_child_expand (toolbar);
gint extra = size / n_expand_items;
if (size % n_expand_items != 0)
extra++;
-
+
+ if (extra > mexpand)
+ extra = mexpand;
+
allocations[i].width += extra;
size -= extra;
n_expand_items--;
return ipadding;
}
+static gint
+get_max_child_expand (GtkToolbar *toolbar)
+{
+ gint mexpand = G_MAXINT;
+
+ gtk_widget_style_get (GTK_WIDGET (toolbar),
+ "max-child-expand", &mexpand,
+ NULL);
+ return mexpand;
+}
+
static GtkShadowType
get_shadow_type (GtkToolbar *toolbar)
{